package com.pride1952.myoptimusx3;

/**
 * Created by 鹏 on 2015/8/20.
 */
public class PlusItem {
    public static final int TYPE_NOTADD = 0;
    private String title;
    private String content;
    private int imgId;
    private int type;

    public PlusItem(String title, String content, int imgId, int type){
        this.title = title;
        this.content = content;
        this.imgId = imgId;
        this.type = type;
    }

    public String getTitle(){
        return title;
    }

    public String getContent(){
        return content;
    }

    public int getImgId(){
        return imgId;
    }

    public int getType(){
        return type;
    }

    /**
     * 改变当前item的type至ADDED状态
     * @param type 传入的状态码，范围1~7
     * @return  若状态码范围正确则改变成功返回true
     */
    public boolean changeTypeToADDED(int type){
        if(type > 0|| type < 8){
            this.type = type;
            return true;
        }
        else
            return false;
    }

    /**
     * 改变当前item的type至NOTADD状态
     * @return 若当前状态为非0则改变成功返回true
     */
    public boolean changeTypeToNOTADD(){
        if(type > TYPE_NOTADD){
            type = TYPE_NOTADD;
            return true;
        }
        else
            return false;
    }
}
